/*
 * XML Type:  XCriteria
 * Namespace: http://www.seedwill.com/xul/criteria
 * Java type: com.seedwill.xul.criteria.XCriteria
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.criteria.impl;
/**
 * An XML XCriteria(@http://www.seedwill.com/xul/criteria).
 *
 * This is a complex type.
 */
public class XCriteriaImpl extends com.seedwill.xul.core.impl.XIdentifiedImpl implements com.seedwill.xul.criteria.XCriteria
{
    private static final long serialVersionUID = 1L;
    
    public XCriteriaImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName SCHEMACODE$0 = 
        new javax.xml.namespace.QName("http://www.seedwill.com/xul/criteria", "schemaCode");
    private static final javax.xml.namespace.QName CRITERIAVALUE$2 = 
        new javax.xml.namespace.QName("http://www.seedwill.com/xul/criteria", "criteriaValue");
    private static final javax.xml.namespace.QName SORT$4 = 
        new javax.xml.namespace.QName("", "sort");
    
    
    /**
     * Gets the "schemaCode" element
     */
    public java.lang.String getSchemaCode()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(SCHEMACODE$0, 0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "schemaCode" element
     */
    public org.apache.xmlbeans.XmlString xgetSchemaCode()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(SCHEMACODE$0, 0);
            return target;
        }
    }
    
    /**
     * Sets the "schemaCode" element
     */
    public void setSchemaCode(java.lang.String schemaCode)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(SCHEMACODE$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(SCHEMACODE$0);
            }
            target.setStringValue(schemaCode);
        }
    }
    
    /**
     * Sets (as xml) the "schemaCode" element
     */
    public void xsetSchemaCode(org.apache.xmlbeans.XmlString schemaCode)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(SCHEMACODE$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(SCHEMACODE$0);
            }
            target.set(schemaCode);
        }
    }
    
    /**
     * Gets array of all "criteriaValue" elements
     */
    public org.apache.xmlbeans.XmlAnySimpleType[] getCriteriaValueArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(CRITERIAVALUE$2, targetList);
            org.apache.xmlbeans.XmlAnySimpleType[] result = new org.apache.xmlbeans.XmlAnySimpleType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "criteriaValue" element
     */
    public org.apache.xmlbeans.XmlAnySimpleType getCriteriaValueArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnySimpleType target = null;
            target = (org.apache.xmlbeans.XmlAnySimpleType)get_store().find_element_user(CRITERIAVALUE$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "criteriaValue" element
     */
    public int sizeOfCriteriaValueArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(CRITERIAVALUE$2);
        }
    }
    
    /**
     * Sets array of all "criteriaValue" element
     */
    public void setCriteriaValueArray(org.apache.xmlbeans.XmlAnySimpleType[] criteriaValueArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(criteriaValueArray, CRITERIAVALUE$2);
        }
    }
    
    /**
     * Sets ith "criteriaValue" element
     */
    public void setCriteriaValueArray(int i, org.apache.xmlbeans.XmlAnySimpleType criteriaValue)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnySimpleType target = null;
            target = (org.apache.xmlbeans.XmlAnySimpleType)get_store().find_element_user(CRITERIAVALUE$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(criteriaValue);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "criteriaValue" element
     */
    public org.apache.xmlbeans.XmlAnySimpleType insertNewCriteriaValue(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnySimpleType target = null;
            target = (org.apache.xmlbeans.XmlAnySimpleType)get_store().insert_element_user(CRITERIAVALUE$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "criteriaValue" element
     */
    public org.apache.xmlbeans.XmlAnySimpleType addNewCriteriaValue()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnySimpleType target = null;
            target = (org.apache.xmlbeans.XmlAnySimpleType)get_store().add_element_user(CRITERIAVALUE$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "criteriaValue" element
     */
    public void removeCriteriaValue(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(CRITERIAVALUE$2, i);
        }
    }
    
    /**
     * Gets the "sort" attribute
     */
    public int getSort()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SORT$4);
            if (target == null)
            {
                return 0;
            }
            return target.getIntValue();
        }
    }
    
    /**
     * Gets (as xml) the "sort" attribute
     */
    public org.apache.xmlbeans.XmlInt xgetSort()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_attribute_user(SORT$4);
            return target;
        }
    }
    
    /**
     * True if has "sort" attribute
     */
    public boolean isSetSort()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(SORT$4) != null;
        }
    }
    
    /**
     * Sets the "sort" attribute
     */
    public void setSort(int sort)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SORT$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(SORT$4);
            }
            target.setIntValue(sort);
        }
    }
    
    /**
     * Sets (as xml) the "sort" attribute
     */
    public void xsetSort(org.apache.xmlbeans.XmlInt sort)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_attribute_user(SORT$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlInt)get_store().add_attribute_user(SORT$4);
            }
            target.set(sort);
        }
    }
    
    /**
     * Unsets the "sort" attribute
     */
    public void unsetSort()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(SORT$4);
        }
    }
}
